use poem_openapi::{OpenApi, payload::{Json}};

use crate::api::shift::vdt::{ApiTags, ShiftInfoRequest, ShiftInfoResponse, ShiftInfo, FlexibleShiftConf };

pub struct AttGroupApi;

#[OpenApi]
impl AttGroupApi {
    #[oai(path = "/getShiftInfo", method = "post", tag = "ApiTags::ShiftInfoRequest")]
    async fn shift_info(
        &self,
        att_req: Json<ShiftInfoRequest>,
    ) -> ShiftInfoResponse {
        println!("访问路径v =================  /api/getClockInfo");
        println!("{:#?}", att_req);
        // PlainText("hello!".to_string())
        let shift_info = ShiftInfo {
            shift_id: String::from("BC100001"),
            shift_name: String::from("固定班次"),
            shift_onoff_count: 1,
            attendance_mean: 1,
            shift_on_time: String::from("08:30"),
            shift_off_time: String::from("18:00"),
            shift_time: 570,
            late_on_minutes_as_late: 0,
            late_on_minutes_as_lack: 60,
            early_minutes_on_clock: 60,
            early_off_minutes_as_early: 10,
            early_off_minutes_as_lack: 30,
            late_minutes_off_clock: 600,
            flexible_shift_conf: Some(FlexibleShiftConf {
                on_late_minutes_as_normal: 120,
                off_early_minutes_as_normal: 120,
            })
        };
        ShiftInfoResponse::Ok(Json(shift_info))
    }


}